package org.nokatag.code;

import java.io.IOException;
import java.io.OutputStream;

import javax.imageio.ImageIO;

public class EncoderHelper
{

    public EncoderHelper()
    {
    }

    public static String getChallangeAndWriteImage(CaptchaService service, String format, OutputStream os)
        throws IOException
    {
        Captcha captcha = service.getCaptcha();
        ImageIO.write(captcha.getImage(), format, os);
        return captcha.getChallenge();
    }
}